package com.glodon.wps.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

/**
 * @Title:
 * @Description:
 * @author: Haijun
 * @emial: isaiah@sohu.com
 * @date 2021/10/2010:06
 */
@Configuration
public class RedisConfig {
    @Autowired
    private RedisConnectionFactory connectionFactory;
    @Bean
    public StringRedisTemplate stringRedisTemplate(){
        StringRedisTemplate stringRedisTemplate = new StringRedisTemplate();
        stringRedisTemplate.setDefaultSerializer(new StringRedisSerializer());
        //stringRedisTemplate.setStringSerializer(new StringRedisSerializer());
        //stringRedisTemplate.setHashKeySerializer(new StringRedisSerializer());
        stringRedisTemplate.setConnectionFactory(connectionFactory);
        return stringRedisTemplate;
    }
}
